package com.boang.fx;

import java.util.ArrayList;
import java.util.Iterator;


/*
    @author:sa
    @date:2024/11/28 16:40
*/
public class ArrayListDemo02 {
    public static void main(String[] args) {
        ArrayList<Student> students = new ArrayList<>();
        students.add(new Student());
        list3(students);
        ArrayList<Programmer> programmers = new ArrayList<>();
        programmers.add(new Programmer());
//        list3(programmers);
    }
    public static void list3(ArrayList<? super Student>list) {
        Iterator<?> iterator = list.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
    public static void list2(ArrayList<? extends Person>list){
        Iterator<?> iterator = list.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
}